package com.tianmao.swing.core;

import netscape.javascript.JSObject;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class ReadFile {
    private JSObject window;

    public ReadFile() {
        this.window = window;
    }

    public String readFile() {
        System.out.println("读取文件方法被调用");
        String filePath = "template.txt";
        String str = "";
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String currentLine;
            while ((currentLine = reader.readLine()) != null) {
                str+=currentLine;
            }
            return str;
        } catch (IOException e) {
            e.printStackTrace();
            return "";
        }
    }
    public void receive(String jsonData) {
        System.out.println("ReadFile receive:"+jsonData);
    }
}